//
//  HZWPlayView.m
//  开心一刻
//
//  Created by lanou on 16/4/9.
//  Copyright © 2016年 刘洋. All rights reserved.
//

#import "HZWPlayView.h"

@implementation HZWPlayView

-(instancetype)initWithFrame:(CGRect)frame url:(NSString *)url{
    if (self = [super initWithFrame:frame])
    {
        AVPlayerItem * item =[AVPlayerItem playerItemWithURL:[NSURL URLWithString:url]];
        self.player =[AVPlayer playerWithPlayerItem:item];
        AVPlayerLayer * layer =[AVPlayerLayer playerLayerWithPlayer:_player];
        layer.frame = frame;
        [self.layer insertSublayer:layer atIndex:0];
        [_player play];
    }
    return  self;
}

@end
